<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>存款类型管理</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap/4.6.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-4">
    <h3>存款类型管理</h3>

    <!-- 查询表单 -->
    <form method="get" th:action="@{/admin/deposit/list}" class="form-inline mb-3">
        <input type="text" class="form-control mr-2" name="savingName" placeholder="存款名称"
               th:value="${savingName}">
        <button type="submit" class="btn btn-primary mr-2">查询</button>
        <a class="btn btn-secondary" th:href="@{/admin/deposit/list}">重置</a >
    </form>

    <div class="mb-3">
        <a class="btn btn-success" th:href="@{/admin/deposit/add}">新增存款类型</a >
        <a class="btn btn-info" th:href="@{/admin/deposit/export}">导出CSV</a >
    </div>

    <table class="table table-bordered table-hover">
        <thead class="thead-dark">
        <tr>
            <th>编号</th>
            <th>名称</th>
            <th>描述</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="d : ${deposits}">
            <td th:text="${d.savingId}"></td>
            <td th:text="${d.savingName}"></td>
            <td th:text="${d.descrip}"></td>
            <td>
                <a th:href="@{'/admin/deposit/edit/' + ${d.savingId}}" class="btn btn-sm btn-warning">修改</a >
                <a th:href="@{'/admin/deposit/delete/' + ${d.savingId}}" class="btn btn-sm btn-danger"
                   onclick="return confirm('确定删除该记录吗？')">删除</a >
            </td>
        </tr>
        <tr th:if="${#lists.isEmpty(deposits)}">
            <td colspan="4" class="text-center">暂无数据</td>
        </tr>
        </tbody>
    </table>
    <!-- 底部返回按钮 -->
    <div class="text-center mt-4 mb-4">
        <a th:href="@{/admin/index}" class="btn btn-primary">返回首页</a >
    </div>
</div>
</body>
</html>